<?php
session_start();
$type = $_POST['type'];

$allabuse = "";

if($type == "b")
{
$forum_thread_id = $_POST['thread_id'];
$forum_section_id = $_POST['forum_section_id'];
$forum_section_title = $_POST['forum_section_title'];
$forum_thread_title = $_POST['forum_thread_title'];
//$member_id = $_POST['member_id'];
$reply_author_id = $_POST['reply_author_id'];
$reply_author = $_POST['reply_author'];
$reply_body = $_POST['reply_body'];
$tbl_id = $_POST['tbl_id'];
			$allabuse = '
				<div style="width:500px">
				<tr>
					<td name="thread_title" id="$forum_thread_title">
					<b>Thread title: </b>'.$forum_thread_title.' 
					</td>
				</tr>	
				
				<tr>
					<td name="reply_author" id="reply_author">
					<b>Reply Author:</b>  '.$reply_author.'
					</td>
				</tr>	
				
				<tr>
					<td name="reply_body" id="reply_body">
					<b>Reply:</b></b> <div style="font-size:18px;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.$reply_body.'</div>	
					</td>
				
				</tr>
				</div>		
			'.'
			<tr>
				<td>
					<div style="width:800px; float:left">	 
						<form action="javascript: process_abuse();" name="send_moderator" id="send_moderator" method="post" >
							<ul id="ulabuse">
								<li id="li_abuse">
									<label>Type of Abuse:</label><br/>
									<input id="type_violation" name="type_violation" type="radio" value="I think this post violates the community guidelines. Chat or rant, adult content, spam, insulting other members">I think this post violates the community guidelines. Chat or rant, adult content, spam, insulting other members
									<br/><input id="type_violation" name="type_violation" type="radio" value=">I think this answer is illegal. Harm to minors, violence or threats, harassment or privacy invasion, impersonation or misrepresentation, fraud or phishing">I think this answer is illegal. Harm to minors, violence or threats, harassment or privacy invasion, impersonation or misrepresentation, fraud or phishing
								</li>
								
								<li id="li_abuse">
								<label>Additional information (Optional):</label><br/>
								<textarea id="others" name="others" style="width:300px; height:50px;"></textarea>
								<!--<input id="others" name="others" type="text" style="width:300px; height:50px;>-->
								</li>
							</ul>
							
							<input name="forum_thread_id" id="forum_thread_id" type="hidden" value='.$forum_thread_id.' />
							<input name="forum_section_id" id="forum_section_id" type="hidden" value='.$forum_section_id.' />
							<input name="forum_section_title" id="forum_section_title" type="hidden" value='.$forum_section_title.' />
							<input name="reply_author_id" id="reply_author_id" type="hidden" value='.$reply_author_id.' />
							<input name="forum_thread_title" id="forum_thread_title" type="hidden" value='.$forum_thread_title.' />
							<input name="reply_author" id="reply_author" type="hidden" value='.$reply_author.' />
							<input name="reply_body" id="reply_body" type="hidden" value='.$reply_body.' />
							<input name="tbl_id" id="tbl_id" type="hidden" value='.$tbl_id.' />
							<input name="type" id="type" type="hidden" value='.$type.' />
							<div id="hassent" name="hassent"></div>
							<div align="center">
							<input id="send_moderator" type="submit" value="Send Complaint"/>
							<input id="back" type="submit" onclick="history.back(1)" value="back"/>
							</div>
						</form>
						
					</div>
				</td>
			</tr>';
}

if($type == "a")
{
$forum_section_id = $_POST['forum_section_id'];
$forum_section_title = $_POST['forum_section_title'];
$reply_author = $_POST['reply_author'];
$tbl_id = $_POST['tbl_id'];
$reply_body = $_POST['reply_body'];
$allabuse = '
				<div style="width:500px">
				<tr>
					<td name="thread_title" id="$forum_thread_title">
					<b>Thread title: </b>'.$forum_section_title.' 
					</td>
				</tr>	
				
				<tr>
					<td name="reply_author" id="reply_author">
					<b>Reply Author:</b>  '.$reply_author.'
					</td>
				</tr>	
				
				<tr>
					<td name="reply_body" id="reply_body">
					<b>Reply:</b></b> <div style="font-size:18px;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.$reply_body.'</div>	
					</td>
				
				</tr>
				</div>
					
			'.'
			<tr>
				<td>
					<div style="width:800px; float:left">	 
						<form action="javascript: process_abuse();" name="send_moderator" id="send_moderator" method="post" >
							<ul id="ulabuse">
								<li id="li_abuse">
									<label>Type of Abuse:</label><br/>
									<input id="type_violation" name="type_violation" type="radio" value="I think this post violates the community guidelines. Chat or rant, adult content, spam, insulting other members">I think this post violates the community guidelines. Chat or rant, adult content, spam, insulting other members
									<br/><input id="type_violation" name="type_violation" type="radio" value=">I think this answer is illegal. Harm to minors, violence or threats, harassment or privacy invasion, impersonation or misrepresentation, fraud or phishing">I think this answer is illegal. Harm to minors, violence or threats, harassment or privacy invasion, impersonation or misrepresentation, fraud or phishing
								</li>
								
								<li id="li_abuse">
								<label>Additional information (Optional):</label><br/>
								<textarea id="others" name="others" style="width:300px; height:50px;"></textarea>
								</li>
							</ul>
							<input name="forum_section_id" id="forum_section_id" type="hidden" value='.$forum_section_id.' />
							<input name="forum_section_title" id="forum_section_title" type="hidden" value='.$forum_section_title.' />
							<input name="reply_author" id="reply_author" type="hidden" value='.$reply_author.' />
							<input name="reply_body" id="reply_body" type="hidden" value='.$reply_body.' />
							<input name="tbl_id" id="tbl_id" type="hidden" value='.$tbl_id.' />
							<input name="type" id="type" type="hidden" value='.$type.' />
							<span id="hassent" name="hassent" align="center"></span>
							<div align="center">
							<input id="send_moderator" type="submit" value="Send Complaint"/>
							<input id="back" type="submit" onclick="history.back(1)" value="back"/>
							</div>
						</form>
						
					</div>
				</td>
			</tr>';

}
?>


<html>
	<head>
	  <?php include('forum_header.php'); ?>	
		<script language="javascript" type="text/javascript">
			
			$('#send_moderator').submit(function(){$('input[type=submit]',this).attr('disabled', 'disabled');});
			function process_abuse( )
			{
				var type = $("#type");
				var type_violation = $("#type_violation"); 
				var others = $("#others");
				var tbl_id = $("#tbl_id");
				var url= "process_abuse.php";
				if(type_violation.val()=="")
				{
				$("#hassent").html('<font size="+2">Please select type of abuse').show().fadeOut(3000);
				}
				else
				{
					if(type.val() == "b")
					{var forum_section_id = $("#forum_section_id");
					 var forum_thread_id = $("#forum_thread_id");
					 var forum_section_title = $("#forum_section_title"); 
					 var forum_thread_title = $("#forum_thread_title");
					 var reply_author_id = $("#reply_author_id");
					 var reply_author = $("#reply_author");
					 var reply_body = $("#reply_body");
				
						$.post(url,
						{type:type.val(), forum_section_id:forum_section_id.val(), forum_thread_id:forum_thread_id.val(), forum_section_title:forum_section_title.val(), forum_thread_title:forum_thread_title.val(), reply_author_id:reply_author_id.val(), reply_author:reply_author.val(), reply_body:reply_body.val(), type_violation:type_violation.val(), others:others.val(), tbl_id:tbl_id.val()},
						function(data)
						{
						$("#hassent").html('<font size="+2">Your report has been sent to the moderator').show().fadeOut(3000);
						}
						
						);
					}
					else if(type.val() == "a")
					{
					 var forum_section_id = $("#forum_section_id");
					 var forum_section_title = $("#forum_section_title"); 
					 var reply_author_id = $("#reply_author_id");
					 var reply_author = $("#reply_author");
					 var reply_body = $("#reply_body");
						$.post(url,
						{type:type.val(), forum_section_id:forum_section_id.val(), forum_section_title:forum_section_title.val(), reply_author_id:reply_author_id.val(), reply_author:reply_author.val(), reply_body:reply_body.val(), type_violation:type_violation.val(), others:others.val(), tbl_id:tbl_id.val()},
						function(data)
						{
						$("#hassent").html('<font size="+2">Your report has been sent to the moderator').show().fadeOut(3000);
						}
						
						);
					}
				}
			}
			
			function back()
			{
			
			}
			
						
		</script>
	</head>

	<body><br><br>
		<table align="center" id="table_abuse" name="table_abuse" border="1" >
			<tr>
				<th>
					<h2 style="font-family:Monotype corsiva, sans-serif;">
					Your Reports Help Protect the Marcelo Community
					</h2>
				</th>
			</tr>
			<?php echo $allabuse; ?>					
			
			
		</table>
		
	</body>
	
	
	
	

</html>